<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="copyright" content="闻康集团刘代明监制" />
<meta name="robots" content="all" />
<?php echo $css_file;?>
</head>
<body>
<div class="main">
	<div class="crumbs">
	当前位置：<span id="current_pos">设置->用户列表</span>
	</div>
    <div class="m_content" id="right_main">
        <div class="content_menu blue line-x">
            <a class="on" href="__GROUP__/Setting/useradd"><em>添加用户</em></a>
        </div>
        <div>
        <!-- 
            <form method="get" action="__GROUP__/Setting/search" name="searchform">
        		<div class="explain_col">
        			用户名：
        			<input type="text" class="input_text" value="" name="keyword" />
        			<input type="submit" value="搜索" class="button" name="search" />
				</div>
			</form>
			 -->
			<form  method="post" action="" name="myForm">
                <div class="table_list">
                <table width="100%" cellspacing="0">
                	<thead>
                		<tr>
                			<th width="20" align="left">
                				<input type="checkbox" id="check_box" onclick="selectAll(this,'userid')" />
                			</th>
                			<th align="left"></th>
                			<th align="left">用户名</th>
                			<th align="left">真实名字</th>
                			<th align="left">角色</th>
                			<th align="left">邮箱</th>
                			<th align="left">注册时间</th>
                			<th align="left">性别</th>
                			<th align="left">手机</th>
                			<th align="left">状态</th>
                			<th align="left">操作</th>
                		</tr>
                	</thead>
                    <tbody>
                    	<?php 
                    	    if(empty($list)){
                    	        echo '<tr><td colspan="11" style="text-align:center;">没有找到任何数据</td></tr>';
                    	    }else {
                    	foreach ($list as $val){
                    	?>
                        <tr>
                    		<td align="left">
                    		    <input type="checkbox" name="userid[]" value="<?php echo $val['id'];?>" />
                    		</td>
                    		<td align="left"></td>
                    		<td align="left"><?php echo $val['username'];?></td>
                    		<td align="left"><?php echo $val['realname'];?></td>
                    		<td align="left"><?php
                    		foreach ($rolelist as $role){
                    			if($role['role_id']==$val['role']){
                    				echo $role['name'];
                    			}
                    		}
                    		?></td>
                    		<td align="left"><?php echo $val['email'];?></td>
                    		<td align="left"><?php echo date("Y-m-d H:i:s",$val['regtime']);?></td>
                    		<td align="left"><?php if ($val['sex']=='1'){echo '男';}else{echo '女';} ?></td>
                    		<td align="left"><?php echo $val['phone'];?></td>
                    		<td align="left"><?php if ($val['state']=='1'){echo '锁定';}else{echo '启用';} ?></td>
                    		<td align="left">
                    			<?php 
                    			if($val['role']==1){
                    				?>
                    				<span style="color:#ccc">[修改]</span> 
                    				<span style="color:#ccc">[删除]</span>
                    				<?php 
                    			}else{
                    			?>
                    			<a href="__GROUP__/Setting/useredit/userid/<?php echo $val['id'];?>">[修改]</a>
                    			<a href="javascript:void(0)" onclick="dialog_delete(this,'__GROUP__/Setting/userdel/userid/<?php echo $val['id'];?>')">[删除]</a>
                    			<?php }?>
                    		</td>
                        </tr>
                        <?php
                    	    } 
                    	}
                        ?>
					</tbody>
                </table>
    			<div class="btn">
    				<label for="check_box">全选/取消</label>
    				<input type="submit" value="锁定" name="dosubmit" class="button" onclick="document.myForm.action='__GROUP__/Setting/userbatchlock'"/>
    				<input type="submit" value="启用" name="dosubmit" class="button" onclick="document.myForm.action='__GROUP__/Setting/userbatchunlock'"/>
    				<input type="button" value="删除" name="dosubmit" class="button" onclick="batch_delete()"/>
    				<?php 
    				if ($userrole=="1"){
    					?>
    				<input type="submit" value="赋予管理员权限" name="dosubmit" class="button" onclick="document.myForm.action='__GROUP__/Setting/userbatchunadmin'"/>
    				<input type="submit" value="取消管理员权限" name="dosubmit" class="button" onclick="document.myForm.action='__GROUP__/Setting/userbatchununadmin'"/>
    					<?php 
    				}
    				
    				?>
    				
    			</div>
    			 <div class="page_number"><?php echo $page;?></div>	
    		</div>
    		</form>
		</div>
    </div>
</div>
<?php echo $js_file,$dialog;?>
<script type="text/javascript">
function selectAll(obj, name){
	if (name == null) {
		name = 'checkboxes';
	}
	var elems = obj.form.getElementsByTagName("input");
	for ( var i = 0; i < elems.length; i++) {
		if (elems[i].name == name || elems[i].name == name + "[]") {
			elems[i].checked = obj.checked;
		}
	}
}
/**
 * 删除提示
 */
function dialog_delete(obj,url){
	$.dialog({
		title:'删除',
		fixed:true,
	    resize: false,
	    ok:true,
	    cancelVal: '取消',
	    cancel: true,
    	content:'确定要删除吗,删除后不可恢复?',
    	ok:function(){
        	window.location.href=url;
        }
		
	});
}
/**
 * 批量删除提示
 */
function batch_delete(){
	$.dialog({
		title:'批量删除',
		fixed:true,
	    resize: false,
	    ok:true,
	    cancelVal: '取消',
	    cancel: true,
    	content:'确定要删除吗,删除后不可恢复?',
    	ok:function(){
    		document.myForm.action='__GROUP__/Setting/userbatchdelete';
    		document.myForm.submit();
        }
		
	});

}
</script>
</body>

</html>
			
